
const d = {};
d.standardizeObj = function(standardize_mapping, obj, align_to_origin){
  const standardizedObj = {};
  for (const key in obj){
    if (key in standardize_mapping) {
      const mapped_to_name = standardize_mapping[key];
      if ("__DELETED__" !== mapped_to_name) {  // __DELETED__的字段则直接跳过即可
        standardizedObj[mapped_to_name] = obj[key];
      }
    } else {
      if (!align_to_origin) { // 如果是align_to_origin=true，则字段默认保留传过来的，否则则默认去除
        standardizedObj[key] = obj[key];  // 不在standardizeMapping中有规则的字段则直接保留
      }
    }
  }
  return standardizedObj;
};

module.exports = d;